using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vkCustMap : EntityTypeConfiguration<vkCust>
    {
        public vkCustMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Identity_Type, t.Sales_Man, t.Store, t.Account_Number, t.Customer_Type, t.POB, t.Nationality });

            // Properties
            this.Property(t => t.Identity_Type)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Sales_Man)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Store)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Cust_ID)
                .HasMaxLength(6);

            this.Property(t => t.Address_1)
                .HasMaxLength(200);

            this.Property(t => t.Address_2)
                .HasMaxLength(35);

            this.Property(t => t.CITY)
                .HasMaxLength(30);

            this.Property(t => t.STATE)
                .HasMaxLength(3);

            this.Property(t => t.ZIP)
                .HasMaxLength(14);

            this.Property(t => t.PHONE)
                .HasMaxLength(19);

            this.Property(t => t.FAX)
                .HasMaxLength(19);

            this.Property(t => t.REGION)
                .HasMaxLength(5);

            this.Property(t => t.First_Name)
                .HasMaxLength(50);

            this.Property(t => t.Last_Name)
                .HasMaxLength(50);

            this.Property(t => t.Father_Name)
                .HasMaxLength(50);

            this.Property(t => t.Identity_Number)
                .HasMaxLength(20);

            this.Property(t => t.GENDER)
                .HasMaxLength(7);

            this.Property(t => t.Account_Number)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.SALUTATION)
                .HasMaxLength(15);

            this.Property(t => t.Social_Security_Code)
                .HasMaxLength(19);

            this.Property(t => t.Driving_License)
                .HasMaxLength(19);

            this.Property(t => t.Phone_1)
                .HasMaxLength(19);

            this.Property(t => t.Phone_2)
                .HasMaxLength(19);

            this.Property(t => t.MOBILE_Phone)
                .HasMaxLength(19);

            this.Property(t => t.PAGER)
                .HasMaxLength(12);

            this.Property(t => t.PO_BOX)
                .HasMaxLength(12);

            this.Property(t => t.SPOUSE_NAME)
                .HasMaxLength(30);

            this.Property(t => t.Customer_Name)
                .HasMaxLength(110);

            this.Property(t => t.POB)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Nationality)
                .IsRequired()
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("vkCust");
            this.Property(t => t.Identity_Type).HasColumnName("Identity Type");
            this.Property(t => t.Sales_Man).HasColumnName("Sales Man");
            this.Property(t => t.Store).HasColumnName("Store");
            this.Property(t => t.Cust_ID).HasColumnName("Cust ID");
            this.Property(t => t.Address_1).HasColumnName("Address 1");
            this.Property(t => t.Address_2).HasColumnName("Address 2");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.STATE).HasColumnName("STATE");
            this.Property(t => t.ZIP).HasColumnName("ZIP");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.FAX).HasColumnName("FAX");
            this.Property(t => t.Max_Amount_on_Dept).HasColumnName("Max Amount on Dept");
            this.Property(t => t.Can_Dept).HasColumnName("Can Dept");
            this.Property(t => t.Freeze_Account).HasColumnName("Freeze Account");
            this.Property(t => t.REGION).HasColumnName("REGION");
            this.Property(t => t.First_Name).HasColumnName("First Name");
            this.Property(t => t.Last_Name).HasColumnName("Last Name");
            this.Property(t => t.Father_Name).HasColumnName("Father Name");
            this.Property(t => t.Identity_Number).HasColumnName("Identity Number");
            this.Property(t => t.GENDER).HasColumnName("GENDER");
            this.Property(t => t.CURRENT).HasColumnName("CURRENT");
            this.Property(t => t.Account_Number).HasColumnName("Account Number");
            this.Property(t => t.Customer_Type).HasColumnName("Customer Type");
            this.Property(t => t.Number_of_Pay_day).HasColumnName("Number of Pay day");
            this.Property(t => t.SALUTATION).HasColumnName("SALUTATION");
            this.Property(t => t.Social_Security_Code).HasColumnName("Social Security Code");
            this.Property(t => t.Driving_License).HasColumnName("Driving License");
            this.Property(t => t.Phone_1).HasColumnName("Phone 1");
            this.Property(t => t.Phone_2).HasColumnName("Phone 2");
            this.Property(t => t.MOBILE_Phone).HasColumnName("MOBILE Phone");
            this.Property(t => t.PAGER).HasColumnName("PAGER");
            this.Property(t => t.PO_BOX).HasColumnName("PO_BOX");
            this.Property(t => t.TRADE_TYPE).HasColumnName("TRADE TYPE");
            this.Property(t => t.MARITAL_STATUS).HasColumnName("MARITAL STATUS");
            this.Property(t => t.SPOUSE_NAME).HasColumnName("SPOUSE NAME");
            this.Property(t => t.Customer_Name).HasColumnName("Customer Name");
            this.Property(t => t.POB).HasColumnName("POB");
            this.Property(t => t.Nationality).HasColumnName("Nationality");
        }
    }
}
